<style type="text/css">
  #content p.title-list-exercises{
    margin:10px 0px 0px 5px;
    font-weight:bold;
    font-size:1.4em;  
  }

  div.components-news{
    width:99%;
    padding-top:5px;
    margin:0px 20px 0px 5px;
    padding-bottom:15px;
    border-bottom: 1px dotted #DDD;
    clear: both;
  }
  div.components-news img{
    border:1px solid #ddd;
    padding:1px;
    float:left;
    margin-right: 10px;
  }
  div.components-news p.title-news{
    font-size:1.2em;
    font-weight: bold;
    /*    
    text-decoration: underline;
    */
    margin-bottom:5px;    
  }
  div.components-news p.title-news a{
    color:black;
  }
  
  #add-exercises{
    float:right;
    margin-right:5px;
}
  
  /**********backcx************/
  
    
    
    #e_done{
       background-color: #DBEAF9;  
    }
  
    .not_done{
        background-color: #D68B8B;  
    }


    
        
        /********* Pagination ************/
    
    .pagination-control{
        position: absolute;
        bottom: 0px;
        width: 655px;
        border-top: 1px solid #E0E0E0;
    }
    .paginator {
        margin-top: 0px;
        text-align: left;
        width: 297px;
    }
    
    .paginator a {
        text-decoration: none;
    }
    
    .paginator ol {
        list-style: none;
        margin: 0;
        padding: 0;
        float: left;
    }
    
    .paginator ol,
    .paginator li,
    .paginator-nav {
        float: left;
    }
    
    .paginator-nav a,
    .paginator-nav span {
        display: block;
        width: 8px;
        height: 48px;
        text-indent: -9999em;
        outline: none;
    }
    
    .paginator-nav a.paginator-next {
        background: url(/doan/source/public/images/btn-next.png) center no-repeat;
    }
    
    .paginator-nav span.paginator-next {
        background: url(/doan/source/public/images/btn-next.png) center no-repeat;
    }
    
    .paginator-nav a.paginator-prev {
        background: url(/doan/source/public/images/btn-preview.png) center no-repeat;
    }
    
    .paginator-nav span.paginator-prev {
        background: url(/doan/source/public/images/btn-preview.png) center no-repeat;
    }
    
    .paginator li {
        line-height: 48px;
    }
    
    .paginator li a,
    .paginator li span {
        display: block;
        padding: 0 6px;
    }
    
    .paginator li span {
        width: 14px;
        height: 48px;
        background: url(/doan/source/public/images/btn-active.png) center no-repeat;
    }
    
    .paginator li a {
        width: 14px;
        height: 48px;
        background: url(/doan/source/public/images/btn-disable.png) center no-repeat;
    }
    
    .paginator li a:hover {
        text-decoration: underline;
    }
        
    
    
   
</style>

<script>
  function deleteNotice(id){
    var comfirmBox;
      var domain = $("#domain").val();
     comfirmBox = confirm("Bạn có chác chắn muốn xóa không ?");
     if(comfirmBox == true)
      {
       $.ajax(
              {
                type:"POST",
              url: domain + "/index/delete-notice",
              data: "id=" + id,
              datatype: "html",
              success: function(html)
                 {
                $("#row" + id).remove();
                 }
              }
              );
      }
  }
</script>


<input type="hidden" value="<?php echo DOMAIN_INDEX ?>" id="domain"/>
<div id="content">
   <?php 
    $sj_name = $this->sj_name; 
    $sj_id = $this->sj_id;  
    $list = $this->notice;
    $auth = Zend_Auth::getInstance();
    $lgNamespace = new Zend_Session_Namespace('enrol_teacher');

    $count = $this->count;
    $now_page = $this->now_page;

    if(($lgNamespace->enrol_teacher ==1) && ($auth->hasIdentity())){
   ?>
     <section class="grid_9" id="dashtabs" style="width:98%;min-height:400px;">
     <p class="title-list-exercises">Danh sách thông báo <?php echo $sj_name ?></p>
     <span id="add-exercises"><a href="<?php echo DOMAIN_INDEX ?>/notice/add-notice">Thêm thông báo</a></span>
  <?php 
      
    //  Zend_Debug::dump($list);die;
      if(count($list)){
        foreach ($list as $key => $value) {
          $url = "/index/show-exercises?url=".$value["url"];
          ?>
          <div id=<?php echo "row".$value["id"] ?> class="components-news">
            <p class="title-news"><?php echo '[ '.$value['code_sj'].' | '.$value["name_sj"].' ] '.$value['title']; ?></p>
            <div class="short-content-news">
              <?php echo "<span style='font-weight:bold;'>Nội dung: </span>".(strip_tags($value["content"])); ?>
              <div style="clear:both"></div>
              <?php 
                
                  echo "<p style='width:30%;float:left;'><span style='font-weight:bold;'>File đính kèm: </span>";
                  if($value["link"]) echo "<a href='".DOMAIN.$value["link"]."'>File đính kèm</a></p>";
                  else echo "Không có! </p>";  
                
              ?>
              <div style="text-align:right">
                  <span><a href="<?php echo DOMAIN_INDEX ?>/notice/edit-notice?id=<?php echo $value["id"] ?>">Chỉnh sửa</a></span>
                  <span onclick="deleteNotice(<?php echo $value["id"] ?>)">Xóa</span>
              </div>
            </div>
          </div>
          <div class="clear"></div>
          <?php
        }
      
  ?>
        <?php 
          if($count > 30){
        ?>
          <div class="box-footer"> <span class="txt-smaller txt-light">Showing <?php echo count($list);?> results of <?php echo $count;?> </span>
          <ul class="pagination">
            <?php 
            if($count > 30){
              if($count%30 == 0){
                $page_count = (int)($count/30)-1;
              } else $page_count =  (int)($count/30);
                if($now_page==1){
                  echo "<li><a title='Current Page ' class='current' href ='".DOMAIN_INDEX."/student/index/page/1'>[1]</a></li>";
                  echo "<li><a title='Page 2' href ='".DOMAIN_INDEX."/index/index/page/2'>2</a></li>";
                  echo "<li><a title='Page 3' href ='".DOMAIN_INDEX."/index/index/page/3'>3</a></li>";
                  echo "<li><a title='Next Page' href='".DOMAIN_INDEX."/index/index/page/".($now_page+1)."'> Next &gt; </a></li>";
                echo "<li><a title='Last Page' href ='".DOMAIN_INDEX."/index/index/page/".($page_count+1)."'> Last &gt;&gt;</a></li>";
                }
                elseif($now_page==$page_count+1){
                  echo "<li><a title='First Page' href = '".DOMAIN_INDEX."/index/index/page/1'> &lt;&lt; First</a></li>";
                echo "<li><a title='Previous Page' href='".DOMAIN_INDEX."/index/index/page/".($now_page-1)."'> &lt; Prev </a></li>";
                  echo "<li><a title='Page ".($now_page-2)."' href ='".DOMAIN_INDEX."/index/index/page/".($now_page-2)."'>".($now_page-2)."</a></li>";
                  echo "<li><a title='Page ".($now_page-1)."' href ='".DOMAIN_INDEX."/index/index/page/".($now_page-1)."'>".($now_page-1)."</a></li>";
                  echo "<li><a title='Current Page' class='current' href ='".DOMAIN_INDEX."/index/index/page/".($now_page)."'>[".($now_page)."]</a></li>";
                } 
              else{
                echo "<li><a title='First Page' href = '".DOMAIN_INDEX."/index/index/page/1'> &lt;&lt; First</a></li>";
                echo "<li><a title='Previous Page' href='".DOMAIN_INDEX."/index/index/page/".($now_page-1)."'> &lt; Prev </a></li>";
                echo "<li><a title='Page ".($now_page-1)."' href ='".DOMAIN_INDEX."/index/index/page/".($now_page-1)."'>".($now_page-1)."</a></li>";
                echo "<li><a title='Current Page' class='current' href ='".DOMAIN_INDEX."/index/index/page/".$now_page."'>[".$now_page."]</a></li>";
                echo "<li><a title='Page ".($now_page+1)."' href ='".DOMAIN_INDEX."/index/index/page/".($now_page+1)."'>".($now_page+1)."</a></li>";
                echo "<li><a title='Next Page' href='".DOMAIN_INDEX."/index/index/page/".($now_page+1)."'> Next &gt; </a></li>";
                echo "<li><a title='Last Page' href ='".DOMAIN_INDEX."/index/index/page/".($page_count+1)."'> Last &gt;&gt;</a></li>";
              }
            } 
          ?>  
      
            </ul>
        </div>
      <?php }
      } ?>
  </section>

  <?php }else if($this->show){?>
  

<?php $dataa= $this->data; //Zend_Debug::dump($data) ?>        
<section class="grid_9" id="dashtabs" style="width:98%; padding-bottom:25px">
     <p class="title-list-exercises">Thông báo:</p>
  <?php 
      if(count($dataa)){
        foreach ($dataa as $value) {
        
          ?>
          <div id=<?php echo "row".$value["id"] ?> class="components-news" style="padding-bottom: 25px;">
            <p class="title-news"><?php echo '[ '.$value['code'].' | '.$value["name"].' ] '.$value['title']; ?></p>
            <div class="short-content-news">
              <?php echo "<span style='font-weight:bold;'>Nội dung: </span>".SubjectsModel::catchu(strip_tags($value["content"]),500); ?>
              <div style="clear:both"></div>
              <?php 
                
                  echo "<p style='width:30%;float:left;'><span style='font-weight:bold;'>File đính kèm: </span>";
                  if($value["link"]) echo "<a href='".DOMAIN.$value["link"]."'>File đính kèm</a></p>";
                  else echo "Không có! </p>";  
                
              ?>
            </div>
          </div>
            
          <div class="clear"></div>
          <?php
            }
            echo '</section>';
            echo $this->paginationControl($this->data, 'Sliding' , 'index/pagination.phtml');           
                }
          ?>
        
      
    
  
  
  
  
  
<?php }else{ ?>
       
<?php $data= $this->data; $id_sv= $this->id_sv;//Zend_Debug::dump($data) ?>        
<section class="grid_9" id="dashtabs" style="width:98%;">
    
  <?php 
      if(count($data)){
        echo "<p class='title-list-exercises'>Danh sách bài tập:</p>";
        foreach ($data as $value) {
        
          ?>
          <div id=<?php echo "row".$value["id"] ?> class="components-news" style="padding-bottom: 25px;">
            <p class="title-news"><?php echo '[ '.$value['code'].' | '.$value["sname"].' ] '.$value['exname']; ?></p>
            <p  class="title-news">Hạn nộp: <?php echo $value['time_end']; ?> </p>
            <div class="short-content-news">
              <?php echo "<span style='font-weight:bold;'>Nội dung: </span>".SubjectsModel::catchu(strip_tags($value["content"]),500); ?>
              <div style="clear:both"></div>
              <?php 
                
                  echo "<p style='width:30%;float:left;'><span style='font-weight:bold;'>File đính kèm: </span>";
                  if($value["link"]) echo "<a href='".DOMAIN.$value["link"]."'>File đính kèm</a></p>";
                  else echo "Không có! </p>";  
                
              ?>
            </div>
          </div>
             <div style=" width:100%; text-align:right">
                   <span>
                        <?php $check= sExerciseModel::checkData($value['id_e'],$id_sv); if($check){?>
                            <img src="<?php echo DOMAIN.'/images/done.png' ?>" />
                        <?php }else{ ?>
                             <img src="<?php echo DOMAIN.'/images/warning.png' ?>" />
                        <?php }?>
                        <a href="<?php echo DOMAIN_INDEX.'/student/submit-exercise?ex_id='.$value['id_e'].'&stu_id='.$id_sv; ?>">
                            Nộp bài
                        </a>
                   </span>
	                  |
                   <span>
                        <?php $check2= PointModel::getDb($id_sv,$value['id_e'],0,''); if(count($check2)){?>
                             <img src="<?php echo DOMAIN.'/images/done.png' ?>" />
                        <?php }else{ ?>
                             <img src="<?php echo DOMAIN.'/images/warning.png' ?>" />
                        <?php } ?>
                       
                        <a href="<?php echo DOMAIN_INDEX.'/student/score-exercise?stu_id='.$id_sv; ?>">
                            Xem điểm
                        </a>
                   </span>
              </div>
          <div class="clear"></div>
          <?php
            }
            echo '</section>';
            echo $this->paginationControl($this->data, 'Sliding' , 'index/pagination.phtml');
            
                }
          ?>
      
    
        
<?php } ?>  
</div>

